﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgilePlannerDT.Data.Impl
{
    public class VoteDotObject : VoteDot
    {
        long cardID;
        int xCord;
        int yCord;

        public VoteDotObject() : this(0, 0, 0) { }

        public VoteDotObject(long id, int x, int y)
        {
            cardID = id;
            xCord = x;
            yCord = y;
        }

        public int X
        {
            get { return this.xCord; }
        }
        
        public int Y
        {
            get { return this.yCord; }
        }

        public long CardID
        {
            get { return this.cardID; }
        }

        #region IXmlSerializable Members

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            throw new NotImplementedException();
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
            this.cardID = (long)Convert.ToDouble(reader.GetAttribute("cardID"));
            this.xCord = Convert.ToInt32(reader.GetAttribute("xCord"));
            this.yCord = Convert.ToInt32(reader.GetAttribute("yCord"));
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("VoteDot");
            writer.WriteAttributeString("cardID", CardID.ToString());
            writer.WriteAttributeString("xCord", X.ToString());
            writer.WriteAttributeString("yCord", Y.ToString());
            writer.WriteEndElement();
        }

        #endregion

    }
}
